within ThermoSysPro.Examples.SimpleExamples;
model TestVolumes2
  ThermoSysPro.WaterSteam.BoundaryConditions.SourceP sourceP annotation(Placement(transformation(x=-88.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SourceP sourceP1 annotation(Placement(transformation(x=-90.0, y=-90.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.LumpedStraightPipe lumpedStraightPipe annotation(Placement(transformation(x=-60.0, y=50.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.LumpedStraightPipe lumpedStraightPipe1 annotation(Placement(transformation(x=-60.0, y=-90.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.ControlValve controlValve annotation(Placement(transformation(x=-46.0, y=-10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false, rotation=-90.0)));
  annotation(Diagram);
  ThermoSysPro.WaterSteam.PressureLosses.ControlValve controlValve1 annotation(Placement(transformation(x=-46.0, y=-70.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false, rotation=-90.0)));
  ThermoSysPro.WaterSteam.PressureLosses.ControlValve controlValve2 annotation(Placement(transformation(x=-10.0, y=26.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.ControlValve controlValve3 annotation(Placement(transformation(x=30.0, y=26.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.ControlValve controlValve4 annotation(Placement(transformation(x=10.0, y=-34.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SinkP sinkP annotation(Placement(transformation(x=50.0, y=-40.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.PressureLosses.LumpedStraightPipe lumpedStraightPipe2 annotation(Placement(transformation(x=60.0, y=20.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.BoundaryConditions.SinkP sinkP1 annotation(Placement(transformation(x=90.0, y=20.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe V4(Starttime=4, Duration=2) annotation(Placement(transformation(x=-30.0, y=70.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe V5(Initialvalue=1) annotation(Placement(transformation(x=10.0, y=70.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe V3(Initialvalue=1, Finalvalue=0, Starttime=4, Duration=3) annotation(Placement(transformation(x=-10.0, y=-10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe V1 annotation(Placement(transformation(x=-90.0, y=-10.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe V2 annotation(Placement(transformation(x=-90.0, y=-70.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.Volumes.VolumeC volumeC(V=1e-18) annotation(Placement(transformation(x=-40.0, y=20.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=false)));
  ThermoSysPro.WaterSteam.Volumes.VolumeA volumeA(V=1e-18) annotation(Placement(transformation(x=-40.0, y=-40.0, scale=0.1, aspectRatio=1.0, flipHorizontal=false, flipVertical=true)));
equation
  connect(sourceP.C,lumpedStraightPipe.C1) annotation(Line(points={{-78,50},{-70,50}}, color={0,0,255}));
  connect(sourceP1.C,lumpedStraightPipe1.C1) annotation(Line(points={{-80,-90},{-70,-90}}, color={0,0,255}));
  connect(lumpedStraightPipe1.C2,controlValve1.C1) annotation(Line(points={{-50,-90},{-40,-90},{-40,-80}}, color={0,0,255}));
  connect(controlValve4.C2,sinkP.C) annotation(Line(points={{20,-40},{40,-40}}, color={0,0,255}));
  connect(controlValve2.C2,controlValve3.C1) annotation(Line(points={{0,20},{20,20}}, color={0,0,255}));
  connect(controlValve3.C2,lumpedStraightPipe2.C1) annotation(Line(points={{40,20},{50,20}}, color={0,0,255}));
  connect(lumpedStraightPipe2.C2,sinkP1.C) annotation(Line(points={{70,20},{80,20}}, color={0,0,255}));
  connect(V4.y,controlValve2.Ouv) annotation(Line(points={{-19,70},{-10,70},{-10,37}}));
  connect(V5.y,controlValve3.Ouv) annotation(Line(points={{21,70},{30,70},{30,37}}));
  connect(V3.y,controlValve4.Ouv) annotation(Line(points={{1,-10},{10,-10},{10,-23}}));
  connect(V1.y,controlValve.Ouv) annotation(Line(points={{-79,-10},{-57,-10}}));
  connect(V2.y,controlValve1.Ouv) annotation(Line(points={{-79,-70},{-57,-70}}));
  connect(volumeC.Cs,controlValve2.C1) annotation(Line(points={{-30,20},{-20,20}}, color={0,0,255}));
  connect(lumpedStraightPipe.C2,volumeC.Ce2) annotation(Line(points={{-50,50},{-40,50},{-40,29}}, color={0,0,255}));
  connect(volumeC.Ce3,controlValve.C2) annotation(Line(points={{-40,10},{-40,0}}));
  connect(controlValve.C1,volumeA.Cs2) annotation(Line(points={{-40,-20},{-40,-30}}));
  connect(volumeA.Cs1,controlValve4.C1) annotation(Line(points={{-30,-40},{0,-40}}, color={0,0,255}));
  connect(volumeA.Ce2,controlValve1.C2) annotation(Line(points={{-40,-49.8},{-40,-60}}));
end TestVolumes2;
